import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    users: {},
    isLogin: false,
    menus: []
  },
  getters: {
    uid: state => state.users.user.id
  },
  mutations: {
    setUsers(state, info) {
      state.users = info;
    },
    setIsLogin(state, flag) {
      state.isLogin = flag;
    },
    setMenus(state, menus) {
      state.menus = menus;
    },
    setUserInfo(state, info) {
      state.users.userInfo = info;
    }
  },
  actions: {},
  modules: {}
});
